Design Principle and Application of RS485 Bus Communication Machine Based on Modbus Protocol

Abstract : This paper discusses in detail the design principle and application of RS485 bus communication machine based on Modbus protocol. The physical structure includes a host computer, a master station, and a plurality of slave nodes. The main station is added between the upper computer and each slave node to undertake the polling work of the upper computer, so that the upper computer is freed from the busy communication work, and the system independence can be improved, and the recovery speed of the system from the fault can be accelerated. The software is based on the Modbus protocol and adds CRC check, which effectively improves the reliability and security of the system. This design has been successfully applied to a prison access control system.

Fieldbus is known as the computer LAN in the field of automation. With the variety of bus types, Modbus technology has been widely used in Modbus serial link communication with its advanced, open and mature. Modbus communication has three modes: serial link, TCP/ IP and ModbusPLUS. The research object of this paper is a device based on serial link master-slave communication structure. In this kind of bus network, the communication between systems generally adopts the manner in which the upper computer polls each node, that is, the upper computer continuously polls each node continuously. When polling a node, the upper computer and the node are certain. Exchange information with each other during the time interval. However, when the number of nodes is large, the time interval for the polling of each node needs to be as short as possible, and the polling work will impose a heavy burden on the host computer. The CPU resources are so large that the host computer cannot focus on completing data processing, and at the same time, the reliability and security of the system are reduced.

For this reason, this paper proposes a new method for serial link, adding a communication machine between the host computer and each node (not to be confused with each node, this article refers to it as the master station), and gives The communication flow based on the upper PC of this master station and each node (the system is called a slave station) and the main program flow of this master station.

1 system hardware environment design

The system hardware environment mainly includes the following modules: host computer, master station, and slave station. For serial link Modbus systems, the physical interface can be RS232 or RS485. The most commonly used interface is the RS485 two-wire interface. The upper computer in this system uses a PC, its physical interface is RS232 interface, and the physical interface of the primary station is RS485 interface. Therefore, the PC cannot directly connect to the RS485 interface, and RS232 and RS485 conversion must be performed between the primary station and the PC. Convert the serial port RS232 signal of the PC to RS485 signal through RS232/RS485 conversion circuit.

Design Principle and Application of RS485 Bus Communication Machine Based on Modbus Protocol

Figure 1 hardware block diagram

In summary, the overall design of the master station and the slave station hardware is shown in Figure 1. The communication between the master station and the host computer adopts the RS232 mode, and the communication between the master station and each node adopts the RS485 mode. The slave station temporarily puts data that has not been transmitted to the PC to the FLASN storage area. The SPI communication is between the slave station and the FLASH memory.

2 network communication protocol 2.1Modbus protocol introduction

The Modbus Serial Link Protocol is a master-slave protocol, and the Modbus Application Layer Message Transport Protocol provides client/server communication between devices connected on the bus or network. On the Modbus serial link, the master node provides the client's functionality while the child node acts as the server. Because Modbus protocol has the advantages of frame format structure, transmission mode, function and content, and high transmission efficiency, it has been widely used in control systems in recent years. The Modbus protocol involved in this thesis is based on the RTU mode standard protocol of the serial link, and expands its frame format structure and scope in combination with practical applications.

The command message transmitted by the host is as follows:

ADOD0D1...DXCRC1CRC2

Description:

ADO: The destination address, which is the site address (or network device address).

D0-DX: Message content, X maximum is 255, (excluding CRC1, CRC2)

CRC1, CRC2: CRC check result. The Modbus-RTU protocol uses a CRC-16 (16-bit cyclic redundancy check) verification method that includes 16-bit binary. The CRC check code is calculated by the sender and placed at the end of the transmitted message. The receiving end recalculates the check code of the received information and compares it with the received check code. If the two do not match, it indicates that the communication is in error.

Semiconductor Fuse And Ferrite

Fuse refers to an electric appliance that, when the current exceeds the specified value, melts the fuse and disconnects the circuit with the heat generated by itself.When the current exceeds the specified value for a period of time, the fuse melts and disconnects the circuit with the heat generated by the fuse itself.A current protector made from this principle.The fuse is widely used in high and low voltage power distribution system and control system as well as power equipment.


Ferrite is a metal oxide with ferrous magnetism.As far as electrical properties are concerned, the resistivity of ferrite is much larger than that of single metal or alloy magnetic materials, and it has higher dielectric properties.Ferrite magnetic energy also shows high permeability at high frequencies.As a result, ferrite has become a non-metallic magnetic material widely used in the field of high frequency and weak current.Due to the low ferrite magnetic energy stored in the unit volume, saturated magnetic induction strength (Bs) and low (usually only pure iron 1/3 ~ 1/5), and thus limits its higher requirements in the low-frequency magnetic energy density in the field of high voltage and high power applications.


Semiconductor Fuse and Ferrite,Fuse Cutout, Protection Fuse, Square Fuse, Fuse Link, Ceramic Fuse

YANGZHOU POSITIONING TECH CO., LTD. , https://www.cnfudatech.com